package kr.ac.kaist.vrowser.application;

import java.io.File;
import java.sql.SQLException;

import kr.ac.kaist.vrowser.controllers.BookmarkController;
import kr.ac.kaist.vrowser.controllers.FormController;
import kr.ac.kaist.vrowser.controllers.WebController;
import kr.ac.kaist.vrowser.db.DatabaseHelper;
import kr.ac.kaist.vrowser.tts.VrowserTextToSpeech;
import android.app.Application;
import android.content.Context;
import android.media.AudioManager;
import android.os.Environment;
import android.speech.tts.TextToSpeech;

public class VrowserApplication extends Application {
	
	private WebController _webController;
	private BookmarkController _bookmarkController;
	private FormController _formController;
	
	private VrowserTextToSpeech _vrowsertts;
	private DatabaseHelper _dbHelper;

	@Override
	public void onCreate() {
		_vrowsertts = new VrowserTextToSpeech(this);
		_dbHelper = new DatabaseHelper(this);
		
		initializeControllers();
		
		/*
		AudioManager am = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
		int amStreamMusicMaxVol = am.getStreamMaxVolume(am.STREAM_MUSIC);
		//am.setStreamVolume(am.STREAM_MUSIC, amStreamMusicMaxVol, 0);
		am.setStreamVolume(am.STREAM_MUSIC, 0, 0);
		*/
	}
	
	public void initializeControllers() {
		_webController = new WebController(this);
		try {
			_bookmarkController = new BookmarkController(this);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		_formController = new FormController(this);;
	}
	
	public WebController getWebController() {
		return _webController;
	}
	
	public BookmarkController getBookmarkController() {
		return _bookmarkController;
	}
	
	public FormController getFormController() {
		return _formController;
	}
	
	public TextToSpeech getTextToSpeech() {
		return _vrowsertts.getTextToSpeech();
	}
	
	public DatabaseHelper getDatabaseHelper() {
		return _dbHelper;
	}
}
